package com.ncloud.param.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.ncloud.param.entity.Tag;

@Mapper
public interface TagMapper{

	@Select("select * from sys_tag where tag_code =#{tagCode} and use_tag='1' and now() between start_date and end_date")
	@Results({@Result(column="tag_code",property="tagCode"),@Result(column="tag_info",property="tagInfo"),
		@Result(column="tag_char",property="tagChar"),@Result(column="tag_number",property="tagNumber"),
		@Result(column="tag_date",property="tagDate"),@Result(column="remark",property="remark")})
	List<Tag> getTags(String tagCode);

	@Select("select * from sys_tag where tag_code =#{tagCode} and use_tag='1' and now() between start_date and end_date limit 1")
	@Results({@Result(column="tag_code",property="tagCode"),@Result(column="tag_info",property="tagInfo"),
			@Result(column="tag_char",property="tagChar"),@Result(column="tag_number",property="tagNumber"),
			@Result(column="tag_date",property="tagDate"),@Result(column="remark",property="remark")})
	Tag getTagOne(String tagCode);
}
